<template>
	<div>
		<van-uploader :after-read="afterRead">
			<van-image
			  round
			  width="10rem"
			  height="10rem"
			  :src="headurl"
			  
			/>
		</van-uploader>
		<van-button @click="tzLogin" type="primary"> 请登录</van-button>
		
		<div style="margin-bottom: 0px;">
		      <van-sticky>
		        <van-tabbar v-model="active" route>
		          <van-tabbar-item replace to="/guahao"  icon="smile-o">首页</van-tabbar-item>
		          <van-tabbar-item icon="manager-o" to="/ghmy">我的</van-tabbar-item>
		        </van-tabbar>
		      </van-sticky>
		</div>
	</div>

	
</template>

<script>
	export default{
		data(){
			return{
				headurl:"https://img.yzcdn.cn/vant/cat.jpeg"
			}
		},methods:{
		tzLogin(){
			this.$router.push("/login");
		},
		afterRead(file){
			var that = this;
			console.log(file);
			const forms = new FormData();
			//这里的file表示给后台传的属性名字，这里看接口文档需要传的属性
			forms.append("file",file.file);//获取上传图片信息
			
			this.axios.post("oss/uploadHeadImg",forms,{
				headers:{
					'Content-Type':'multipart/form-data',
					
				},
			}).then((res)=>{
						if(res.data.code==200){
							that.headurl=res.data.data;
						}
					}).catch((e)=>{
				
				})
			}
		}
		
	}
	
	
	
	
</script>

<style>
	
</style>
